<!--
 * @Author: 陈永浩(cyh1231wp@163.com)
 * @Date: 2021-03-01 16:03:25
 * @LastEditors: 陈永浩(cyh1231wp@163.com)
 * @LastEditTime: 2021-03-02 22:07:39
-->
<template>
  <div>
    <Layout>
      <Header class="header flex flex-items-center" :style="{ background: '#fff' }">
        <h1 class="flex-1">
          Phala Tools
        </h1>
        <div class="flex-1 flex flex-items-center flex-end" v-if="backFlag">
          <span class="cursor-pointer" @click="backPre">
            返回上一页
          </span>
          <span class="cursor-pointer margin-left" @click="toStartup">
            首页
          </span>
        </div>

      </Header>
      <Content>
        <div class="container">
          <router-view />
        </div>
      </Content>
    </Layout>
  </div>
</template>

<script>
export default {
  data() {
    return {
      backFlag: false,
    };
  },
  mounted() {
    this.$router.push("/startup");
  },
  watch: {
    "$route.path": function (newVal, oldVal) {
      if (newVal != "/startup") {
        this.backFlag = true;
      } else {
        this.backFlag = false;
      }
    },
  },
  methods: {
    toStartup() {
      this.$router.push("/startup");
    },
    backPre() {
      this.$router.go(-1);
    },
  },
};
</script>

<style lang="scss" scoped>
.container {
  padding: 50px;
}
</style>
